import service from '@/api/request/request'

export function getModelList () {
  return service({
    url: '/model/list',
    method: 'get'
  })
}

export function getModelListGrant () {
  return service({
    url: '/model/list/grant',
    method: 'get'
  })
}

export function getModelListPublic () {
  return service({
    url: '/model/public/list',
    method: 'get'
  })
}

export function getModelListAvailable () {
  return service({
    url: '/model/available/list',
    method: 'get'
  })
}

export function getModel (id) {
  return service({
    url: '/model/get',
    method: 'get',
    params: {
      model_id: id
    }
  })
}

export function getModelCommit (params) {
  return service({
    url: '/model/commit/get',
    method: 'get',
    params
  })
}

export function editModel (data) {
  return service({
    url: '/model/edit',
    method: 'post',
    data
  })
}

export function deleteModel (data) {
  return service({
    url: '/model/delete',
    method: 'post',
    data
  })
}

export function grantModel (data) {
  return service({
    url: '/model/grant',
    method: 'post',
    data
  })
}

export function getModelMemberList (params) {
  return service({
    url: '/model/grant/user/list',
    method: 'get',
    params
  })
}

export function deleteModelGrant (data) {
  return service({
    url: '/model/grant/delete',
    method: 'post',
    data
  })
}

export function changeModelPublic (data) {
  return service({
    url: '/model/public/edit',
    method: 'post',
    data
  })
}

export function createModel (data) {
  return service({
    url: '/model/create',
    method: 'post',
    headers: {
      'Content-Type': 'multipart/form-data'
    },
    data
  })
}

export function getModelHistory (params) {
  return service({
    url: '/model/history',
    method: 'get',
    params
  })
}
